/**
 * 
 */

//
import { Children, isValidElement } from 'react'

const extendChildrenProps = (children, props) => {
  return Children.map(children, (child) => {
    return extendElementProps(child, props)
  })
}

const extendElementProps = (component=<></>, props={}) => {
  const ref = props.ref || component.ref;
  return {...component, props: {...component.props, ...props}, ref}
}

const extendProps = extendElementProps

export {
  extendChildrenProps,
  extendElementProps,
  extendProps,
}